package field_method05;

public class PersonTest {

    public static void main(String[] args) {

        Person person = new Person();
        person.name = "小张";
        person.age = 18;
        //它养了一条狗 狗的名字叫 花花 2岁了

//        System.out.println(person.dog);//是null
//        person.dog.nickName = "花花";//空指针异常

        Dog dog = new Dog();
        dog.nickName = "花花";
        dog.age = 2;

        person.dog = dog;

        System.out.println(person.dog);




    }
}
